package com.example.client_demo.service;

import com.example.client_demo.entity.OUser;
import com.example.client_demo.mapper.OUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:
 * @Author: mayc
 * @Date: 2019/03/18 09:24
 */
@Service
public class OUserService {

    @Autowired
    private OUserMapper oUserMapper;

    public OUser getByAccessToken(String accessToken) {
        OUser oUser = oUserMapper.getByAccessToken(accessToken);
        return oUser;
    }

    /**
     * 根据accessToken 检查本地是否有存储过该accessToken信息
     * @param accessToken
     * @return true 存储过  false 未存储过
     */
    public boolean hasStore(String accessToken) {
        return getByAccessToken(accessToken) != null;
    }
}
